import { genGood } from './good';
import { genData } from './data';
import { getRandomNum } from '../utils/mock';


export function getGoodsList(baseID = 0, length = 10) {
  return new Array(length).fill(0).map((_, idx) => genGood(idx + baseID));
}

export const goodsList = getGoodsList();


export function getDataList(baseID = 0, length = 10) {
  let items = [];
  for (var index = 0; index < 10; index++) {
    var item = JSON.parse(JSON.stringify(genData()));
    var type = getRandomNum(1, 2);
    var status = getRandomNum(1, 3);
    item.type = type;
    item.status = status;
    items.push(item)
  }
  return items;
  // return new Array(length).fill(0).map((_, idx) => genData(idx + baseID));
}

export const dataList = getDataList();
